package com.ybfenpan.controller.member.center;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ybfenpan.controller.core.BaseController;
import com.ybfenpan.model.Member;
import com.ybfenpan.service.center.RequestCenterService;
import com.ybfenpan.taglib.pagetag.Pagination;
import com.ybfenpan.utils.ContextUtil;

/**
 * Created by Administrator on 2016/3/25.
 */
@Controller
public class MemberRequestCenterListController extends BaseController {

	@Resource
	private RequestCenterService requestCenterService;

	@RequestMapping("member/center/memberRequestCenterList.shtml")
	public String add(ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {

		Member member = ContextUtil.getMember();
		String loginName = member.getLoginName();
		Map formMap = getParameterMap(request);
		formMap.put("where", "b.loginName= '" + loginName + "'");
		formMap.put("pagination.orderBy", " a.id desc"); // 排列
		Pagination page = requestCenterService.queryForPageList("requestCenterForPage", formMap);
		request.setAttribute(Pagination.pageBeanName, page);

		return "member/center/memberRequestCenterList";

	}

}
